// 路由模块

// 导入vue-router
import VueRouter from 'vue-router'

// 导入组件
import home from '../components/tabbar/home.vue'
import member from '../components/tabbar/member.vue'
import cart from '../components/tabbar/cart.vue'
import search from '../components/tabbar/search.vue'

// 导入/home 子组件
import newslist from '../components/home/newslist.vue'
import newsinfo from '../components/home/newsinfo.vue'
import photolist from '../components/home/photolist.vue'
import photoinfo from '../components/home/photoinfo.vue'
import goodslist from '../components/home/goodslist.vue'
import goodsinfo from '../components/home/goodsinfo.vue'
import goodsdesc from '../components/home/goodsdesc.vue'
import goodscomment from '../components/home/goodscomment.vue'

// 创建路有对象
const router = new VueRouter({
  routes: [
    { path: '/', redirect: '/home'},
    { path: '/home', component: home},    
    { path: '/home/newslist', component: newslist},
    { path: '/home/newsinfo/:id', component: newsinfo},        
    { path: '/home/photolist', component: photolist},        
    { path: '/home/photoinfo/:id', component: photoinfo},        
    { path: '/home/goodslist', component: goodslist},   
    { path: '/home/goodsinfo/:id', component: goodsinfo, name: 'goodsinfo'},   
    { path: '/home/goodsdesc/:id', component: goodsdesc, name: 'goodsdesc'},   
    { path: '/home/goodscomment/:id', component: goodscomment, name: 'goodscomment'},   
    { path: '/member', component: member},
    { path: '/cart', component: cart},
    { path: '/search', component: search},
  ],
  linkActiveClass: 'mui-active' // 覆盖默认路由高亮类
})

// 对外接口导出
export default router
